package com.bonjour.work.utils.enums;

public enum ArticleStatus {
	NORAML(1, "normal"),
	BANNED(2, "banned");
	
	private Integer type;
    private String desc;
    
    ArticleStatus(Integer type, String desc) {
		this.type = type;
		this.desc = desc;
	}

	public Integer getType() {
		return type;
	}

	public void setType(Integer type) {
		this.type = type;
	}

	public String getDesc() {
		return desc;
	}

	public void setDesc(String desc) {
		this.desc = desc;
	}
    
	public static String getDesc(Integer type){

        if (type==null){
            return NORAML.desc;
        }

        for(ArticleStatus statusEnum: ArticleStatus.values()){
            if (statusEnum.type==type){
                return statusEnum.desc;
            }
        }

        return type+"";
    }
}
